<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<style>
			.top {
				margin-top: 20px;
			}
			
			.mui-btn-block {
				padding: 6px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">设置密码</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group top">
				<div class="mui-input-row">
					<input id='password' type="password" class="mui-input-clear mui-input" placeholder="输入密码">
				</div>
				<div class="mui-input-row">
					<input id='restPassword' type="password" class="mui-input-clear mui-input" placeholder="确认密码">
				</div>
			</form>

			<div class="mui-content-padded top">
				<button id='reg' class="mui-btn mui-btn-block mui-btn-primary">确定</button>
			</div>
		</div>
		<script src="../libs/js/mui.min.js"></script>
		<script src="../libs/js/jquery-3.2.1.min.js"></script>
		<script src="../libs/js/jquery.i18n.properties.js"></script>
		<script src=" ../js/common.js"></script>
		<script type="text/javascript">
			function plusReady() {
				var self = plus.webview.currentWebview();
				mui('body').on('tap', '.mui-btn', function() {
					if(isNull($('#password').val())) {
						mui.toast("请输入密码");
						return;
					}
					if(isNull($('#restPassword').val())) {
						mui.toast("请输入确认密码");
						return;
					}
					if($('#restPassword').val() != $('#password').val()) {
						mui.toast("两次密码输入不一致");
						return;
					}
					var ajax = {
						"phone": self.phone,
						"password": $('#password').val(),
						"msiCode": self.testcode,
					}
					ajAjax("register.do", ajax, function(data) {
						mui.toast("注册成功")
						var _self = plus.webview.currentWebview().close();
			         	plus.webview.open("login.html")
					}, function(err) {

					});
				})
			}

			if(window.plus) {
				plusReady();
			} else {
				document.addEventListener('plusready', plusReady, false);
			}
		</script>
	</body>

</html>